package com.ssy.lingxi.logistics.controller.feign;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.logistics.api.dto.request.CommonIdsRequest;
import com.ssy.lingxi.logistics.api.dto.response.ShipperAddressDetailResponse;
import com.ssy.lingxi.logistics.service.IMessageQueueHandleService;
import com.ssy.lingxi.logistics.service.IShipperAddressService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * @menu 内部接口 - 发货地址
 * @author yzc
 * @version 2.0.0
 * @date 2020/7/10
 */
@RestController
public class ShipperAddressFeignController extends BaseController {

    @Resource
    private IShipperAddressService shipperAddressService;
    @Resource
    private IMessageQueueHandleService addressFeignService;


//    /**
//     * 新增发货地址
//     * @param request 请求参数
//     * @return 操作结果
//     */
//    @RequestMapping(value = "/logistics/shipperAddress/feign/add", method = RequestMethod.POST)
//    public Wrapper<Void> addShipperAddress(@RequestBody ShipperAddressAddFeignRequest request) {
//        return addressFeignService.addShipperAddress(request);
//    }
//
//    /**
//     * 修改发货地址
//     * @param request 请求参数
//     * @return 操作结果
//     */
//    @RequestMapping(value = "/logistics/shipperAddress/feign/update", method = RequestMethod.POST)
//    public Wrapper<Void> updateShipperAddress(@RequestBody LogisticsAddressSyncFeignRequest request) {
//        return addressFeignService.updateShipperAddress(request);
//    }

    /**
     * 发货地址查询
     * @param id 主键id
     * @return 返回结果
     */
    @RequestMapping(value = "/logistics/shipperAddress/feign/get", method = RequestMethod.GET)
    public Wrapper<ShipperAddressDetailResponse> getShipperAddress(@RequestParam Long id) {
        return shipperAddressService.getShipperAddressDetail(id);
    }

    /**
     * 发货地址查询
     * @param idsRequest 主键id
     * @return 返回结果
     */
    @RequestMapping(value = "/logistics/shipperAddress/feign/list", method = RequestMethod.POST)
    public Wrapper<List<ShipperAddressDetailResponse>> listShipperAddress(@Valid @RequestBody CommonIdsRequest idsRequest) {
        return shipperAddressService.listShipperAddress(idsRequest);
    }
}
